﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ThongKePK_TinhTrangGiuong_popup.aspx.cs" Inherits="ToaThuoc_PAK.ThongKePK_TinhTrangGiuong_popup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .even{ background:#FFF; }
        .odd{ background:#CCC;}
    </style>
    <script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function TableEvenOdd(selector) {
            $(selector).find('tr:nth-child(odd)').addClass("odd");
            $(selector).find('tr:nth-child(even)').addClass("even");
        }
        $(document).ready(function () {
            TableEvenOdd(".clstblThongKe");
            var TongGiuong = 0;
            var TongBN = 0;
            var temp = 0;
            $('table.clstblThongKe tr:not(:first):not(:last)').each(function () {
                var _Giuong = eval($(this).find('td.TongGiuong').text());
                var _BN = eval($(this).find('td.TongSoBN').text());
                if (!_Giuong) { _Giuong = 0; $(this).find('td.TongGiuong').text('Chưa có giường'); }
                TongGiuong += _Giuong;
                TongBN += _BN;
                if (_BN > _Giuong) { $(this).find('td').css({ 'color': 'red' }); }
            });
            $('#TongSoGiuong').text(TongGiuong);
            $('#TongSoBenhNhan').text(TongBN);
            $('table.clstblThongKe tr td,table.clstblThongKe tr th').css({ 'padding': '3px 3px 3px 10px' });
        });

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="clstblThongKe" border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;
            width: 100%;">
            <tr style="background-color: #4A65A5; color: White" class="no">
                <th>
                    Khoa</th>
                <th>
                    Tổng giường</th>
                <th>
                    Tổng BN</th>
            </tr>
            <asp:Repeater ID="rpTinhTrangGiuong" runat="server">
                <ItemTemplate>
                    <tr>
                        <td>
                            <%#Eval("TenKhoa") %>
                        </td>
                        <td align="center" class="TongGiuong">
                            <%#Eval("TongGiuong").ToString().Trim() %>
                        </td>
                        <td align="center" class="TongSoBN">
                            <%#Eval("TongSoBN").ToString().Trim()%>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
            <tr style="font-weight:bolder; background-color:InfoBackground">
                <td align="right">Tổng số:</td>
                <td id="TongSoGiuong" align="center" >0</td>
                <td id="TongSoBenhNhan" align="center">0</td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

